package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TravelCustomerMapper;
import com.ruoyi.system.domain.TravelCustomer;
import com.ruoyi.system.service.ITravelCustomerService;
import com.ruoyi.common.utils.BaiduOcrUtils;
import org.json.JSONObject;

/**
 * 客户信息Service业务层处理
 */
@Service
public class TravelCustomerServiceImpl implements ITravelCustomerService {
    @Autowired
    private TravelCustomerMapper travelCustomerMapper;

    /**
     * 查询客户信息
     * 
     * @param customerId 客户信息主键
     * @return 客户信息
     */
    @Override
    public TravelCustomer selectTravelCustomerById(Long customerId) {
        return travelCustomerMapper.selectTravelCustomerById(customerId);
    }

    /**
     * 查询客户信息列表
     * 
     * @param travelCustomer 客户信息
     * @return 客户信息
     */
    @Override
    public List<TravelCustomer> selectTravelCustomerList(TravelCustomer travelCustomer) {
        return travelCustomerMapper.selectTravelCustomerList(travelCustomer);
    }

    /**
     * 新增客户信息
     * 
     * @param travelCustomer 客户信息
     * @return 结果
     */
    @Override
    public int insertTravelCustomer(TravelCustomer travelCustomer) {
        return travelCustomerMapper.insertTravelCustomer(travelCustomer);
    }

    /**
     * 修改客户信息
     * 
     * @param travelCustomer 客户信息
     * @return 结果
     */
    @Override
    public int updateTravelCustomer(TravelCustomer travelCustomer) {
        return travelCustomerMapper.updateTravelCustomer(travelCustomer);
    }

    /**
     * 批量删除客户信息
     * 
     * @param customerIds 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteTravelCustomerByIds(Long[] customerIds) {
        return travelCustomerMapper.deleteTravelCustomerByIds(customerIds);
    }

    /**
     * OCR识别身份证
     * 
     * @param imageBase64 图片base64字符串
     * @return 识别结果
     */
    @Override
    public Object ocrIdCard(String imageBase64) {
        // 调用百度OCR API识别身份证
        JSONObject result = BaiduOcrUtils.idCardRecognition(imageBase64, "front");
        return result;
    }

    /**
     * OCR识别护照
     * 
     * @param imageBase64 图片base64字符串
     * @return 识别结果
     */
    @Override
    public Object ocrPassport(String imageBase64) {
        // 调用百度OCR API识别护照
        JSONObject result = BaiduOcrUtils.passportRecognition(imageBase64);
        return result;
    }
} 